LearningStorePrivilegedScope Class

Marks LearningStore-related operations in a code block as privileged, which means that security checks are not performed

Namespace: Microsoft.LearningComponents.Storage

Assembly: Microsoft.LearningComponents.Storage.dll

Syntax
C#

public sealed class LearningStorePrivilegedScope : IDisposable

Constructors
Name Description
Ð LearningStorePrivilegedScope

Initializes a new instance of the LearningStorePrivilegedScope

Properties
Name Description
ÐS Current

Current scope

Methods
Name Description
Ð Dispose

Ends the privileged scope.

Remarks

To execute a set of LearningStore-related operations without security checks, add the commands to the job within a LearningStorePrivilegedScope (that is, between the initialization of a LearningStorePrivilegedScope object and the calling of its Dispose method).

Privileged scopes can be nested.

Example

The following code adds a new user item to the store specified by "store" with security checks turned off:

C#
// Create the property values
Dictionary<string,object> propertyValues = new Dictionary<string,object>();
propertyValues["Name"] = "John Doe";
propertyValues["Key"] = "Company\JohnDoe";
 
// Create a job and add the "add item" operation
LearningStoreJob job = store.CreateJob();
 
using(LearningStorePrivilegedScope scope = new LearningStorePrivilegedScope())
{
    // add the "add item" operation"
    job.AddItem("UserItem", propertyValues, false);
}
 
// Execute the job
job.Execute();